#ifndef _MYMAINWINDOW_
#define _MYMAINWINDOW_

#include <QtGui/QtGui>
#include "ui_interface.h"

/// Implements the main window by inheriting from Ui::MainWindow.
class MyMainWindow : public QMainWindow, private Ui::MainWindow 
{
   Q_OBJECT
   
public:
   /// Constructor
   MyMainWindow (QMainWindow *parent = 0);
   
   /// try to load a model 
   void open_model(QString fileName=QString());
   
   /// try to load a skeleton file
   void open_skeleton(QString filename);
   
   /// try to load an skinning file
   void open_skinning(QString filename);
   
   /// process the input parameters
   void open(int argc, char * argv[]);
   
private slots:
   
   /// Automatically bound to the actionOpen menu item of the main window 
   /// by the designer mechanism.
   void on_actionOpen_model_triggered();
   void on_actionOpen_skeleton_triggered();
   
   /// Automatically bound to the actionSave_as_model menu item of the main window 
   /// by the designer mechanism.
   void on_actionSave_as_model_triggered();
   void on_actionSave_as_skeleton_triggered();
   
   void on_actionOpen_skinning_triggered();
   void on_actionSave_as_skinning_triggered();
   
   void on_actionViewModel_triggered();
   void on_actionViewInfo_triggered();
   void on_actionViewFloor_triggered();
   void on_actionViewSkeleton_triggered();
   
   void on_actionRenderPoints_triggered();
   void on_actionRenderWireframe_triggered();
   void on_actionRenderFlat_triggered();
   void on_actionRenderFlatLines_triggered();
   void on_actionRenderHiddenLines_triggered();
   void on_actionRenderSmooth_triggered();
   void on_actionRenderTransparency_triggered();
   void on_actionLightOnOff_triggered();
   void on_actionProjection_triggered();
   void on_actionViewRigging_triggered();
   void on_actionViewSkinning_triggered();
   void on_actionViewRiggingEdges_triggered();
   void on_actionNoViewRigSkin_triggered();
   
   void on_actionVertexJoints_changed();
   void on_actionVertexJoint_changed();
   void on_actionJointVs_changed();
   void on_actionJointV_changed();
   
   void viewVertexJointGroup_triggered(QAction *);
   void on_actionViewClusters_triggered();
   
   // Executes the automatic creation algorithm
   void on_actionCreateSkeleton_triggered();
   
   // Executes the rigging (clustering) algorithm
   void on_actionRigging_triggered();
   
   // Executes the skinning algorithm
   void on_actionSkinning_triggered();
   
   // Set on/off the view flag closest joint
   void on_actionClosestJoint_triggered();
   // Set on/off the view flag associations
   void on_actionAssociations_triggered();
   
   void on_actionEditSkeleton_triggered();
   
   void on_spinDifussionAmplitude_valueChanged();
   void on_spinNumberIterations_valueChanged();
   void on_spinNumberExpansions_valueChanged();
   void on_spinLapFilterAlpha_valueChanged();
   
   void on_rb_clustering_bones_toggled();
   void on_rb_clustering_joints_toggled();
   
private:
   QButtonGroup         *clusteringGroup;
   QActionGroup         *meshrenderGroup;
   QActionGroup         *meshRigSkinGroup;
   QActionGroup         *viewVertexJointGroup;
   QString              filenamemodel;
   
   /// Animation data
   //~ QTimer               *timer;

   bool                 flag_skeleton; // true if was defined a skeleton
   uint                 kcenters;
};

#endif
